const info = document.getElementById('info')
info.innerHTML = `Chrome(v${window.versions.chrome}),Node.js(v${window.versions.node}))`
const btn = document.getElementById('btn')
const titleInput = document.getElementById('title')
btn.addEventListener('click', () => {
    const title = titleInput.value
    window.electron.setTitle(title)
})
const btn2 = document.getElementById('btn2')
const contentInput = document.getElementById('content')
const counter = document.getElementById('counter')
btn2.addEventListener('click', async() => {
    const content = contentInput.value
    const result = await window.electron.writeFile(content)
    info.innerHTML = result
    const c = await window.electron.readFile('test.txt',{encoding: 'utf-8'})
    info.innerHTML += `file content:${c}`
})
console.log('2222',window.electron)
window.electron.onUpateCounter((value) => {
    console.log('value',value)
    counter.innerText = value.toString()
})